<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>现金滴滴</title>
<link href="/dist/css/all_min.css" tppabs="http://www.115yz.com/xjkc/dist/css/all_min.css" rel="stylesheet">
</head>
<body>
<!--页头 start-->
<div id="header" class="kc-fixed kc-boxBody kc-commonHeight kc-commonbg">
    <div class="kc-rel">   
        <div class="float-left kc-cannel kc-pos">
             <div class="icon-bar"></div>
        </div>
        <a class="float-left kc-title textCenter">现金滴滴</a>
         <img src="/dist/img/msg.png" class="kc-msg">
    </div>
</div>
<!--页头 end-->
<!--主体 start-->
<div id="bodyer" class="kc-padbody kc-boxBody">
    <div class="kc-rel">
        <div class="kc-boxBody">
            <img src="/dist/img/bg.png" tppabs="http://www.115yz.com/xjkc/dist/img/homeBanner.jpg" class="kc-img-response" />
            <img src="/dist/img/mainbg.png" tppabs="http://www.115yz.com/xjkc/dist/img/homeBanner.jpg" class="kc-img-response mainbg"  />
            <img src="/dist/img/logo.png" tppabs="http://www.115yz.com/xjkc/dist/img/homeBanner.jpg" class="kc-img-response logo" />
            <!-- 0 申请中 -->
            <?php if(isset($applyData)){  ?>
            <?php switch($applyData){
            case $applyData['LoanStatus']==7: ?>
                <div id='statusChange'>
                    <div class="availableText">
                        <?php echo '订单审核中'; ?>
                    </div>
                    <div class="availableMoney">
                        <div style="position: relative;"><img src="/dist/img/loading.png" alt="" style="width:42px;"></div>
                        <span style="font-size: 16px;"><?php echo '预计24小时内审核完毕，请耐心等待' ?></span> 
                    </div>
                </div>
                <div class="kc-boxBody kc-home-btn kc-btn" style="margin-top: .6rem;">
                    <img src="/dist/img/hu.png" class="imgOne">
                    <div class="iconBox">
                        <span><img src="/dist/img/brush.png" class="brush"><div>急速审核</div></span> 
                        <span><img src="/dist/img/computer.png" class="comp"><div>通过率高</div></span> 
                        <span><img src="/dist/img/flash.png" id='flash' class="flash"><div>闪电放款</div></span>  
                    </div>
                    <div class="chooseMoney"> 
                        <div>
                            <div class="title">借款金额</div>
                            <div style="font-size: 24px;border:none">
                                    <span class="icon" style="font-size: 18px;">￥</span><?php  echo $applyData['ApplyMoney']  ?>
                            </div>
                        </div>
                        <div>
                            <div class="title">借款期限</div>
                            <div style="font-size: 24px;border:none">
                                   <span style="font-size: 24px;"><?php  echo $applyData['ApplyDay']  ?>天</span>
                            </div>
                        </div>
                    </div>
                    <div class="applyNow">
                        <img src="/dist/img/lookDetail.png" class='applyRecord'> 
                    </div>
                    <div class="shield"><img src="/dist/img/shield.png">  不向学生提供任何服务</div>
                </div>
        </div>
        <?php break;?>
        <!-- 2 已放款 -->
        <?php  case $applyData['LoanStatus']==2: ?>
        <div id='statusChange'>
            <div class="availableText">
                    <?php echo '距离还款日'; ?>
            </div>
            <div class="availableMoney">
                    <span style="font-size: 15px;"><?php echo "<span style='font-size:28px'> $endDay </span>天<Br>记得及时还款哦～"; ?></span> 
            </div>
        </div>
        <div class="kc-boxBody kc-home-btn kc-btn">
            <img src="/dist/img/hu.png" class="imgOne">
            <div class="iconBox">
                <span><img src="/dist/img/brush.png" class="brush"><div>急速审核</div></span> 
                <span><img src="/dist/img/computer.png" class="comp"><div>通过率高</div></span> 
                <span><img src="/dist/img/flash.png" id='flash' class="flash"><div>闪电放款</div></span>  
            </div>
            <div class="chooseMoney"> 
                <div>
                    <div class="title">应还金额</div>
                    <div style="font-size: 24px;border:none">
                            <span class="icon" style="font-size: 24px;">￥</span><?php  echo $applyData['ApplyMoney']  ?>
                    </div>
                </div>
                <div>
                    <div class="title">还款日期</div>
                    <div style="font-size: 24px;border:none">
                            <span style="font-size: 24px;"><?php  echo substr($applyData['YyFkTime'],0,10)  ?></span>
                     </div>
                </div>
            </div>
            <div class="fkdiv">
                <img src="/dist/img/returnNow.png" onclick = returnNow() style=" padding-top: 30px;">
                <?php if($isShow==1) {?>
                <img src="/dist/img/xuqi.png" onclick = returnXu()>
                <?php }?>
            </div>
        </div>
    </div>
    <?php break;?>  

    <!-- 1 放款中 -->
    <?php  case $applyData['LoanStatus']==1: ?>
        <div id='statusChange'>
            <div class="availableText">
                    <?php echo '订单放款中'; ?>
            </div>
            <div class="availableMoney">
                    <div style="position: relative;"><img src="/dist/img/takeoff.png" alt="" style="width:45px;"></div>
                    <span style="font-size: 15px;"><?php echo "已为你安排打款，预计2小时内到账";?></span> 
            </div>
        </div>
        <div class="kc-boxBody kc-home-btn kc-btn" style="    margin-top: .6rem;">
                <img src="/dist/img/hu.png" class="imgOne">
                <div class="iconBox">
                    <span><img src="/dist/img/brush.png" class="brush"><div>急速审核</div></span> 
                    <span><img src="/dist/img/computer.png" class="comp"><div>通过率高</div></span> 
                    <span><img src="/dist/img/flash.png" id='flash' class="flash"><div>闪电放款</div></span>  
                </div>
                <div class="chooseMoney"> 
                    <div>
                        <div class="title">借款金额</div>
                                <div style="font-size: 24px;border:none">
                                        <span class="icon" style="font-size: 24px;">￥</span><?php  echo $applyData['ApplyMoney']  ?>
                                </div>
                    </div>
                    <div>
                        <div class="title">借款期限</div>
                                <div style="font-size: 24px;border:none">
                                        <span style="font-size: 24px;"><?php  echo $applyData['ApplyDay']  ?>天</span>
                                 </div>
                    </div>
                </div>
            <div class="applyNow">
                <img src="/dist/img/lookDetail.png" class='applyRecord'>
            </div>
            <div class="shield"><img src="/dist/img/shield.png" id="pay">  不向学生提供任何服务</div>
        </div>
        </div>
    <?php break;?>  


        <!-- 4 已逾期 -->
        <?php  case $applyData['LoanStatus']==9: ?>
        <div id='statusChange'>
            <div class="availableText" style="top: -28px;">
                    <?php echo '订单已逾期'; ?>
            </div>
            <div class="availableMoney">
                    <div style="position: relative;top: -20px;"><span style="color:#FF6C6C;font-size:26px;"><?php echo $yuDay; ?><span style="font-size:16px;color:#FF6C6C;">天</span></span></div>
                    <span style="font-size: 15px;"><?php echo '您已逾期，请立即还款！';?></span> 
            </div>
        </div>
        <div class="kc-boxBody kc-home-btn kc-btn" style="margin-top:0.62rem;">
                <img src="/dist/img/hu.png" class="imgOne">
                <div class="iconBox">
                    <span><img src="/dist/img/brush.png" class="brush"><div>急速审核</div></span> 
                    <span><img src="/dist/img/computer.png" class="comp"><div>通过率高</div></span> 
                    <span><img src="/dist/img/flash.png" id='flash' class="flash"><div>闪电放款</div></span>  
                </div>
                <div class="chooseMoney"> 
                        <div>
                            <div class="title">应还金额</div>
                            <div style="font-size: 24px;border:none">
                                    <span class="icon" style="font-size: 24px;">￥</span><?php  echo $applyData['ApplyMoney']  ?>
                            </div>
                        </div>
                        <div>
                            <div class="title">还款日期</div>
                            <div style="font-size: 24px;border:none">
                                    <span style="font-size: 24px;"><?php  echo substr($applyData['YyFkTime'],0,10)  ?></span>
                             </div>
                        </div>
                    </div>
                    <div class="fkdiv">
                        <img src="/dist/img/returnNow.png" onclick = returnNow() style=" padding-top: 30px;">
                        <?php if($isShow==1) {?>
                            <img src="/dist/img/xuqi.png" onclick = returnXu()>
                            <?php }?>
                    </div>
         </div>
        </div>
        <?php break;?> 





    <!-- 5 已拒绝 -->
    <?php  case $applyData['LoanStatus']==5: ?>
    <div id='statusChange'>
        <div class="availableText" style="top: -28px;">
                <?php echo '审核未通过'; ?>
        </div>
        <div class="availableMoney">
                <div style="position: relative;top: -18px;"><img src="/dist/img/stop.png" alt="" style="width:42px;"></div>
                <span style="font-size: 15px;position: relative;top:-18px;"><div id="countdown" style="height: 6%;"></div></span> 
        </div>
    </div>
    <div class="kc-boxBody kc-home-btn kc-btn" style="margin-top:0.35rem;">
            <img src="/dist/img/hu.png" class="imgOne">
            <div class="iconBox">
                <span><img src="/dist/img/brush.png" class="brush"><div>急速审核</div></span> 
                <span><img src="/dist/img/computer.png" class="comp"><div>通过率高</div></span> 
                <span><img src="/dist/img/flash.png" id='flash' class="flash"><div>闪电放款</div></span>  
            </div>
            <div class="chooseMoney"> 
                <div>
                    <div class="title">借款金额</div>
                    <div>
                            <select id="m" onchange="changeItem(this)">
                                <?php foreach($moneyArr as $k=>$val){ ?>
                                <option value="<?php echo $k ?>">￥<?php echo $val  ?></option>
                                <?php }?>
                            </select>
                    </div>
                </div>
                <div>
                    <div class="title">借款期限</div>
                    <div>
                            <select id='d' onchange="changeIt(this)">
                                <?php foreach($timeArr as $k=>$val){ ?>
                                <option value="<?php echo $k ?>"><?php echo $val  ?>天</option>
                                <?php }?>
                            </select>
                    </div>
                </div>
            </div>
        <div class="applyNow">
            <img src="/dist/img/gray.png" class=''>
        </div>
        <div class="shield"><img src="/dist/img/shield.png" id="pay">  不向学生提供任何服务</div>
     </div>
    </div>
    <?php break;?>  




    <!-- 默认 -->
    <?php  default: ?>
    <div id='statusChange'>
            <div class="availableText">
                可用额度(元)
            </div>
            <div class="availableMoney">
                <span class="icon">￥</span><?php echo $default[0]['defont'] ?>
            </div>
        </div>
        <div class="kc-boxBody kc-home-btn kc-btn">
            <img src="/dist/img/hu.png" class="imgOne">
            <div class="iconBox">
                <span><img src="/dist/img/brush.png" class="brush"><div>急速审核</div></span> 
                <span><img src="/dist/img/computer.png" class="comp"><div>通过率高</div></span> 
                <span><img src="/dist/img/flash.png" id='flash' class="flash"><div>闪电放款</div></span>  
            </div>
            <div class="chooseMoney"> 
                <div>
                    <div class="title">借款金额</div>
                    <div>
                        <select id="m" onchange="changeItem(this)">
                            <?php foreach($moneyArr as $k=>$val){ ?>
                            <option value="<?php echo $k ?>">￥<?php echo $val  ?></option>
                            <?php }?>
                        </select>
                    </div>
                </div>
                <div>
                    <div class="title">借款期限</div>
                    <div>
                        <select id='d' onchange="changeIt(this)">
                                <?php foreach($timeArr as $k=>$val){ ?>
                                <option value="<?php echo $k ?>"><?php echo $val  ?>天</option>
                                <?php }?>
                        </select>
                    </div>
                </div>
            </div>
            <div class="applyNow">
                <?php if(isset($authen) && $authen!=0){ ?>
                <img src="/dist/img/applyNow.png"  class="apply">
                <?php }else{?>
                <img src="/dist/img/_applyNow.png" class="apply">
                <?php }?>
            </div>
            <div class="shield"><img src="/dist/img/shield.png" id="pay">  不向学生提供任何服务</div>
        </div>
    </div>





             <?php }?>
	        <?php }else{ ?>
                <div id='statusChange'>
                    <div class="availableText">
                        可用额度(元)
                    </div>
                    <div class="availableMoney">
                        <span class="icon" style="font-size:18px;">￥</span><?php echo $default[0]['weimoney'] ?>
                    </div>
                </div>
                <div class="kc-boxBody kc-home-btn kc-btn">
                    <img src="/dist/img/hu.png" class="imgOne">
                    <div class="iconBox">
                        <span><img src="/dist/img/brush.png" class="brush"><div>急速审核</div></span> 
                        <span><img src="/dist/img/computer.png" class="comp"><div>通过率高</div></span> 
                        <span><img src="/dist/img/flash.png" id='flash' class="flash"><div>闪电放款</div></span>  
                    </div>
                    <div class="chooseMoney"> 
                        <div>
                            <div class="title">借款金额</div>
                            <div>
                                <select id="m" onchange="changeItem(this)">
                                <?php foreach($moneyArr as $k=>$val){ ?>
                                <option value="<?php echo $k ?>">￥<?php echo $val  ?></option>
                                <?php }?>
                                </select>
                            </div>
                        </div>
                        <div>
                            <div class="title">借款期限</div>
                            <div>
                                <select id='d' onchange="changeIt(this)">
                                <?php foreach($timeArr as $k=>$val){ ?>
                                <option value="<?php echo $k ?>"><?php echo $val  ?>天</option>
                                <?php }?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="applyNow">
                        <?php if(isset($authen) && $authen!=0){ ?>
                        <img src="/dist/img/applyNow.png"  class="apply">
                        <?php }else{?>
                        <img src="/dist/img/_applyNow.png" class="apply">
                        <?php }?>
                    </div>
                    <div class="shield"><img src="/dist/img/shield.png" id="pay">  不向学生提供任何服务</div>
                </div>
        </div>

            <?php }?>
    </div>
</div>
<!--主体 end-->
<!--页脚 start-->
<div id="footer" class="kc-fixed kc-boxBody kc-contBodybg kc-commonHeight">
    <div class="kc-rel">
        <ul class="footerUl">
            <li class="active">
                <span>
                    <a href="/index.php/index/index">
                        <div><img src="/dist/img/icon-hk-hover.png"></div>
                        <div>首页</div>
                    </a>
                </span>
            </li>
            <li>
                <span>
                    <a href="/index.php/index/my">
                        <div><img src="/dist/img/icon-wd.png"></div>
                        <div>我的</div>
                    </a>
                </span>
            </li>
        </ul>
    </div>
</div>
<!--页脚 end-->
<script src="/resourse/jquery/jquery-1.11.3.min.js" tppabs="http://www.115yz.com/xjkc/resourse/jquery/jquery-1.11.3.min.js"></script>
<script src="/dist/js/all_min.js" tppabs="http://www.115yz.com/xjkc/dist/js/all_min.js"></script>
<script src="/dist/js/july.js"></script>
<script type="text/javascript">
    $('.apply').click(function(){
        let session = <?php echo $session ?>;
        if(session==null){
            openTip('暂未登录')
            setTimeout("url('/index.php/index/login')",1000)
        }
        let authen = <?php echo $authen ;?>;

        if(authen >0){
            openWin("您还有 <?php echo $authen ;?> 项未认证",'/index.php/index/authen');
        }else{
            let money = $("#m option:selected").text()
            let day = $("#d option:selected").text()
            $.ajax({
                url:'/index.php/index/applyProduct',
                type:'post',
                data:{ApplyMoney:money,ApplyDay:day},
                dataType:'json',
                success:function(data){
                    let json = JSON.parse(data)
                    let jsonData =JSON.stringify(json.data)
                    if(json.status==1){
                        url('/index.php/index/applyIndeed?param='+jsonData)
                    }else{
                         openTip(json.msg)
                        return
                    }                   
                   
                }
            })
        }
    }) 
    $('.applyRecord').click(function(){
        url('/index.php/index/applyRecord')
    })

    let bankName = "<?php if(isset($bankData)){ echo $bankData['BankName']; }else{ echo '' ;}  ?>";
    let cardNum = "<?php if(isset($bankData)){ echo substr($bankData['BankNo'],-4); }else{ echo '' ;}   ?>";
    //立即还款
    function returnNow(){
        //唤起支付方式遮罩层
        // let returnMoney = "<?php if(isset($applyData)){ echo $applyData['ApplyMoney']; }else{ echo '' ;} ?>";//要么是全款
        let returnMoney= "0.01";
        let type=1;//还全款
        payShadow(bankName,cardNum,returnMoney,type);
    }
    //续期
   function returnXu(){
        let xuMoney = "0.01";// 要么是续期款
        // let xuMoney ="<?php if(isset($applyData)){ echo $applyData['GuanliCost']; }else{ echo '' ;} ?>";
        let day ="<?php if(isset($applyData)){ echo $applyData['afterXuDate']; }else{ echo '' ;} ?>";
        url('/index.php/index/orderRenewal?xuMoney='+xuMoney+'&day='+day+"&bankName="+bankName+'&cardNum='+cardNum)
   }
    function payShadow(a,b,c,d){
        let html;
        html ='<div class="modal-window"><div class="modal-shadow" onclick=removeShadow()></div>\
        <div class="payBtn">\
            <div class="top">立即还款</div>\
            <div class="top top2"><span class="money">¥</span>'+c+'</div>\
            <div class="top top3">现金滴滴延期还款费用</div>\
            <div class="paypay"><img src="/dist/img/weixin.png"><span>微信支付</span><img src="/dist/img/Oval.png" onclick="oval(this)" class="oval" data-id=0></div>\
            <div class="paypay"><img src="/dist/img/ziyuan.png"><span>支付宝支付</span><img src="/dist/img/Oval.png" onclick="oval(this)"  class="oval" data-id=1></div>\
            <div class="paypay"><img src="/dist/img/yinlian.png"><span>'+a+'('+b+')</span><img src="/dist/img/Oval.png" onclick="oval(this)"  class="oval"data-id=2></div>\
            <div><span><img src="/dist/img/pay.png" id="pays" onclick="pays('+c+','+d+')"></span></div>\
            </div>\
        </div>';
		$('body').append(html); 
    }
    let hostname = 'http://'+location.host;
    function oval(img){
        if(img.src ==hostname+'/dist/img/Oval.png'){
            img.src ="/dist/img/OO.png";//变实 其他按钮变空
            let divs = $(img).parent().siblings('.paypay').find('img.oval') ;
            for(let i=0; i<divs.length;i++){
                divs[i].src="/dist/img/Oval.png";
            }
        }else{
            img.src ="/dist/img/Oval.png"    
        }
    }
    //主支付方式 银行卡
    function pays(c,d){
        //选择支付方式
        let payway = $('.payBtn div img.oval');
        let data = {};
        data.name = "<?php  echo $user['TrueName'] ?>";
        data.Id ="<?php  echo $user['IDCard'] ?>";
        data.mobile ="<?php if(isset($bankData)){ echo $bankData['YMobile']; }else{ echo '' ;} ?>";
        data.BankNo ="<?php if(isset($bankData)){ echo $bankData['BankNo']; }else{ echo '' ;} ?>";
        data.OrderSn= "<?php if(isset($applyData)){ echo $applyData['OrderSn']; }else{ echo '' ;} ?>";
        data.Money=c;
        data.Type=1;
        let count =0;
        for(let i=0;i<payway.length;i++){
            if(payway[i].src==hostname+'/dist/img/OO.png'){
                count++;
                let dataId = $(payway[i]).attr('data-id');
                if(dataId==0){
                    openTip('微信支付尚未开通');
                } else if(dataId==1) {
                    openTip('支付宝支付尚未开通');
                }else{
                     $.ajax({
                         url:'/api.php/bank/pay',
                         type:'POST',
                         data:data,
                         success:function(data){
                            //  console.log(data);return;
                            let json = JSON.parse(data);
                            if(json.status==1){
                                window.location.href=json.data;
                            }else{
                                openTip(json.data);
                                return false;   
                            }
                         }
                     })
                }
            }
        }
      if(count==0){
        openTip("尚未选择支付方式");
        return false;
      }
    }
    //改变额度与借款周期关联
    function changeItem(select){
        let se = $('#d').find('option')
        let index = $(select).find('option:selected').val()
       for(let i=0;i<se.length;i++){
            if(i ==index){
                $(se[i]).prop('selected',true)
            }
            
       }
    }
    //改变额度与借款周期关联
    function changeIt(select){
        let se = $('#m').find('option')
        let index = $(select).find('option:selected').val()
       for(let i=0;i<se.length;i++){
            if(i ==index){
                $(se[i]).prop('selected',true)
            }
            
       }
    }

    //设置倒计时
    function ShowCountDown(year,month,day,divname){
            var now = new Date();
            var endDate = new Date(year, month, day);
            var leftTime=endDate.getTime()-now.getTime();
            var dd = parseInt(leftTime / 1000 / 60 / 60 / 24, 10);//计算剩余的天数
            var hh = parseInt(leftTime / 1000 / 60 / 60 % 24, 10);//计算剩余的小时数
            var mm = parseInt(leftTime / 1000 / 60 % 60, 10);//计算剩余的分钟数
            var ss = parseInt(leftTime / 1000 % 60, 10);//计算剩余的秒数
            dd = checkTime(dd);
            hh = checkTime(hh);
            mm = checkTime(mm);
            ss = checkTime(ss);//小于10的话加0
            var cc = document.getElementById(divname);
            if(cc){
                cc.innerHTML = "<div style='font-size:16px;'>距离下次提交审核还有:</div><span style='color:#DBA86D'>" + dd + "天" + hh + "小时" + mm + "分" + ss + "秒</span>请耐心等待！"; 
            }
           
    }
    function checkTime(i){
            if (i < 10) {
                i = "0" + i;
            }
            return i;
    }

    window.setInterval(function(){ShowCountDown("<?php echo $Y ?>","<?php echo $M ?>","<?php echo $D ?>",'countdown');}, 1000);





</script>
</body>
</html>